<form id="mainform" name='frm' method=post action="">
    <table width = 100% id="id-form">
        <tr>
            <td width="10%" nowrap="nowrap">Tên tour
            </td>
            <td >
                <input type=text class="inp-form" name=name value="<?=$this->name?>" size=25>
            </td>
        </tr>
        <tr>
            <td nowrap="nowrap">Trạng thái</td>
            <td>
                Tất cả&nbsp;&nbsp; <input type="radio" <?php echo $trangthai['2']; ?> onclick="timkiemAction()" name="phamvi" value="2" />&nbsp;&nbsp;
                Chưa kích hoạt&nbsp;&nbsp;<input type="radio" <?php echo $trangthai['0']; ?> name="phamvi" onclick="timkiemAction()" value="0" />&nbsp;&nbsp;
                Đã kích hoạt&nbsp;&nbsp;<input type="radio" name="phamvi" value="approved" <?php echo $trangthai['approved']; ?> onclick="timkiemAction()" />
            </td>
        </tr>
        <tr>
            <td nowrap="nowrap"></td>
            <td><input type='button' onclick="timkiemAction()" value="Tìm kiếm">
            </td>
        </tr>
    </table >
    <table style="margin-top: 10px" border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
        <thead>
            <tr class="alternate-row">
                <th width="5%" style="text-align: center" nowrap="nowrap">STT</th>
                <th width="5%" style="text-align: center" nowrap valign="left">
                    <input type=checkbox name=DELALL onclick="SelectAllU(this,'DEL')">
                </th>
                <th width="80%" style="text-align: left">Tên tour</th>
        
                <th style="text-align: center" width="10%" style="text-align: left">Kích hoạt</th>
            </tr>
        </thead>
        <tfoot>
        </tfoot>
        <tbody>
            <?php
				if (count($this->data)== 0) {
					echo "<tr><td colspan=6>Không có dữ liệu nào được tìm thấy</td></tr>";
						} else {
							$stt = 1;
							}foreach ($this->data as $item) {
			?>
            <tr>
                <td style="text-align: center" ><?=$stt ?></td>
                <td style="text-align: center">
                    <input id="<?=$item['id'] ?>" type="checkbox" name="DEL[]" value="<?=$item['id'] ?>" />
                </td>
                <td> <a href="#" onClick="ItemClickU(<?php echo $item['id'] ?>)">
                        <?=$item['name']; ?></a>
                </td>

                <td style="text-align: center"><span id="status<?=$item['id'] ?>"> <a href="#" onClick="capnhatactive(<?php echo $item['id'] ?>)">
                        
                        <?php if ($item['status'] != 1) {
		echo '<font color="#004FA0"> Chưa kích hoạt</font>';
	} else {
		echo 'Đã kích hoạt';
	}
																																				  ?></a>
                    </span>
                </td>
            </tr>
            <?php $stt++;
																																				  }
				 ?>
        </tbody>
    </table>

</form>
<script>
    function ItemClickU(id)
    {
         document.frm.action = "/danhmuc/category/input/id/"+id;
         document.frm.submit();
    }
    function add(){
        document.location.href='/danhmuc/category/input';
    }
    function SelectAllU(selobj,childobj){
         var arr = document.getElementsByName(childobj+"[]");
         for(var i=0;i<arr.length;i++){
            arr[i].checked = selobj.checked;
         }
    }
    function timkiemAction(){
        common.submitForm(document.frm,'');
    }
    function del()
    {
    	  var ln = 0;
          var arr = document.getElementsByName('DEL[]');
          for(var i = 0 ; i < arr.length ;i++ )
          {
                  if(arr[i].checked == true)
                  {
                          ln = 1;
                          break;
                  }
          }
          
          if(ln == 1)
          {
                  if(confirm("<?php echo "Bạn có muốn xóa không"; ?>")){
                          document.frm.action="/danhmuc/category/delete";
                          document.frm.method="post";
                          document.frm.submit();
                  }
          }
          else
          {
                  alert("Bạn phải một dòng chọn để xóa");
          }
    }

</script>
